using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Data;

namespace ldapAccountGen
{
    class Colleges
    {
        private Properties.Settings settings = Properties.Settings.Default;
        public Hashtable CollgesTbl = new Hashtable();

        public Colleges()
        {
            initColleges();
        }
        public void initColleges()
        {
            DataSet result = new DataSet();
            try
            {
                string appPath = System.AppDomain.CurrentDomain.BaseDirectory;
                FileStream xmlFile = new FileStream(appPath + settings.COLLEGE_FILE, FileMode.Open, FileAccess.Read, FileShare.Read);
                result.ReadXml(xmlFile);
                xmlFile.Close();
                foreach (DataRow college in result.Tables[0].Rows)
                {
                    this.add(college[1].ToString(), college[0].ToString());
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
        public void add(string key, string value)
        {
            CollgesTbl.Add(key, value);
        }
        public String getValue(String key)
        {
            return CollgesTbl[key].ToString();
        }
        public System.Collections.ICollection getKeys()
        {
            return CollgesTbl.Keys;
        }
        public System.Collections.ICollection getValues()
        {
            return CollgesTbl.Values;
        }
        public int Count
        {
            get { return CollgesTbl.Count; }
        }
    }
}
